home *** CD-ROM | disk | FTP | other *** search
- >>>>> Andrew Bell <abell@mindspring.com> writes:
-
- > One problem, though, is that you may not care about the actual class
- > of an object, but just whether it is derived from (or is) of a
- > particular class, and RTTI doesn't help you there.
-
- Why do you say that? That's precisely what dynamic_cast is for.
-
-
- ...
-
- typedef class_where_method_is_introduced T;
- if (T* p = dynamic_cast<T*>(generic_ptr))
- {
- p->method ();
- }
-
- ...
-
- Jason
-
-
- [ comp.std.c++ is moderated. To submit articles: try just posting with ]
- [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
- [ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
- [ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
- [ Comments? mailto:std-c++-request@ncar.ucar.edu ]
-